package cn.gyouzhe.service.impl;

import cn.gyouzhe.entity.Seller;
import cn.gyouzhe.mapper.SellerMapper;
import cn.gyouzhe.service.ISellerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * 卖家SERVICE
 *
 * @author wangchuan
 * @datetime 2018/3/3 16:13
 */
@Service
@Transactional(readOnly = true)
public class SellerService implements ISellerService {
    @Autowired
    private SellerMapper sellerMapper;

    /**
     * 查询卖家
     * @param sellerId  卖家ID
     * @return 卖家实体
     */
    @Override
    public Seller selectSeller(String sellerId) {
        return sellerMapper.selectSeller(sellerId);
    }

    /**
     * 保存卖家
     * @param seller 卖家信息
     */
    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
    @Override
    public void saveSeller(Seller seller) {
        sellerMapper.saveSeller(seller);
    }

    /**
     * 更新卖家
     * @param seller 卖家信息
     */
    @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
    @Override
    public void updateSeller(Seller seller) {
        sellerMapper.updateSeller(seller);
    }
}
